
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>配置加载与初始化 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>配置加载与初始化 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">在MyBatis框架中，配置加载过程的首要作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">配置加载是MyBatis框架初始化的第一步，负责加载并解析配置文件，以初始化所有配置信息，包括数据库连接池、SQL映射、类型处理器和缓存等重要组件，从而保证系统能够正确初始化并启动。</div>
          </div>
          <div class="card-source">来源: 1. 配置加载的作用与重要性</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">哪个类是MyBatis配置加载的起点，它的核心职责是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">配置加载过程从 `SqlSessionFactoryBuilder` 类开始。它的核心职责是根据 `mybatis-config.xml` 等配置文件来创建 `SqlSessionFactory` 对象，后者是MyBatis执行SQL的核心。</div>
          </div>
          <div class="card-source">来源: 2. 配置加载的核心类——SqlSessionFactoryBuilder</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">`XMLConfigBuilder` 在MyBatis配置加载中扮演了什么角色？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`XMLConfigBuilder` 是MyBatis的配置解析器，它负责将XML配置文件（如 `mybatis-config.xml`）通过DOM解析，并将解析出的配置信息加载到一个 `Configuration` 对象中。</div>
          </div>
          <div class="card-source">来源: 3. XMLConfigBuilder解析配置文件</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">MyBatis中的 `Configuration` 类是什么，它包含了哪些核心配置信息？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`Configuration` 类是MyBatis的核心配置类，它保存着MyBatis的所有配置信息，包括数据库连接信息、映射器信息、插件、类型处理器等。</div>
          </div>
          <div class="card-source">来源: 4. Configuration类的初始化</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">配置</div>
          <div class="card-question">在 `mybatis-config.xml` 中，通常使用哪些XML节点来配置数据库连接信息？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">配置</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">数据库连接信息通常通过 `<environment>` 和 `<dataSource>` 节点进行配置。</div>
          </div>
          <div class="card-source">来源: 5. 解析数据库连接配置</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">当 `XMLConfigBuilder` 解析到 `<mappers>` 节点时，它会如何处理其中的Mapper文件？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它会遍历 `<mappers>` 节点下的每个 `<mapper>` 子节点，获取其资源路径，然后创建一个 `XMLMapperBuilder` 实例来解析具体的 `Mapper.xml` 文件，并将解析后的SQL语句注册到 `Configuration` 中。</div>
          </div>
          <div class="card-source">来源: 7. Mapper文件的加载与解析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在解析Mapper文件时，`XMLMapperBuilder` 的具体作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`XMLMapperBuilder` 负责解析具体的 `Mapper.xml` 文件，将其中定义的SQL语句解析并映射到 `MappedStatement` 对象。</div>
          </div>
          <div class="card-source">来源: 7. Mapper文件的加载与解析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">配置</div>
          <div class="card-question">文档中提到了哪两种 `DataSource` 类型可以配置，它们分别代表什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">配置</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到了 `POOLED` 和 `UNPOOLED` 两种类型。`POOLED` 代表使用连接池，而 `UNPOOLED` 代表不使用连接池。</div>
          </div>
          <div class="card-source">来源: 5. 解析数据库连接配置</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">MyBatis如何处理配置文件中的自定义类型处理器（Type Handlers）和插件（Plugins）？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`XMLConfigBuilder` 会读取 `<typeHandlers>` 和 `<plugins>` 节点下的配置，并将它们分别添加到 `Configuration` 对象的 `typeHandlerRegistry` 和 `pluginRegistry` 中进行注册。</div>
          </div>
          <div class="card-source">来源: 6. 解析类型处理器和插件配置</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
